﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;

namespace NExtension.Tests
{
    [TestFixture]
    public class NextensionTests
    {

        [Test]
        public void TestRepeat()
        {
            int[] result = Nextension.Repeat(3, 5).ToArray();
            Assert.AreEqual(5, result.Length);
            Assert.AreEqual(3, result[0]);
            Assert.AreEqual(3, result[1]);
            Assert.AreEqual(3, result[2]);
            Assert.AreEqual(3, result[3]);
            Assert.AreEqual(3, result[4]);
        }

        [Test]
        public void TestIterate()
        {
            int[] result = Nextension.Iterate(1, 5, i => i * 2).ToArray();
            Assert.AreEqual(5, result.Length);
            Assert.AreEqual(1, result[0]);
            Assert.AreEqual(2, result[1]);
            Assert.AreEqual(4, result[2]);
            Assert.AreEqual(8, result[3]);
            Assert.AreEqual(16, result[4]);
        }

    }
}
